Ext.define("SHApp.CompanyManage.CompanyInfo.Form", {
    extend: "BLBTSystem.Form",
    submitUrl: "api/companyinfo?format=json",
    winWidth: 665,
    winHeight: 360,
    userComboBox: null,
    txtUserID: "txtUserID",
    txtUserName: null,
    initComponent: function () {
        var me = this;
        me.txtUserID += me.id;
        Ext.apply(this);
        me.userComboBox = Ext.create("SHApp.CompanyManage.CompanyInfo.UserComboBox", {
            fieldLabel: "客户负责人",
            allowBlank: false,
            blankText: "请选择",
            name: "UserID",
            editable: false
        })
        this.createItems();
        this.callParent(arguments);

        me.txtUserName = Ext.getCmp(me.txtUserID);
        me.userComboBox.on("select", function (objMe, newVal, oldVal, obj) {
            me.txtUserName.setValue(objMe.getDisplayValue());
        })
    },
    createItems: function () {
        var me = this;
        this.items = [{
            width: 300,
            border: false,
            bodyStyle: "background:#DFE9F6",
            layout: { type: "vbox", align: "stretch" },
            items: [
				{
				    xtype: "textfield",
				    fieldLabel: "ID",
				    name: "Id",
				    hidden: true
				}, {
				    xtype: "textfield",
				    fieldLabel: "SuperiorID",
				    name: "SuperiorID",
				    hidden: true
				}, {
				    fieldLabel: "企业中文名称<span style='color:red'>*</span>",
				    xtype: "textfield",
				    name: "ChineseFullName",
				    maxLength: 50,
                    allowBlank:false,
                    blankText:"企业名字不能为空"
				}, {
				    fieldLabel: "企业中文简称",
				    xtype: "textfield",
				    name: "ChineseShortName",
				    maxLength: 50
				}, {
				    fieldLabel: "企业英文全称",
				    xtype: "textfield",
				    name: "EnglishFullName",
				    maxLength: 50
				}, {
				    fieldLabel: "企业英文缩写",
				    xtype: "textfield",
				    name: "EnglishShortName",
				    maxLength: 50
				}, {
				    fieldLabel: "工商注册号",
				    xtype: "textfield",
				    name: "BankNumber",
				    maxLength: 50
				}, {
				    fieldLabel: "注册地",
				    xtype: "textfield",
				    name: "RegisterRoom",
				    maxLength: 50
				}, {
				    fieldLabel: "公司所在地",
				    xtype: "textfield",
				    name: "CompanyPlace",
				    maxLength: 50
				}, {
				    fieldLabel: "其他业务信息",
				    xtype: "textareafield",
				    name: "Other",
				    maxLength: 50,
				    rows: 3,
				    cols: 150
				}]
        }, {
            width: 300,
            border: false,
            bodyStyle: "background:#DFE9F6",
            layout: { type: "vbox", align: "stretch" },
            items: [
                {
                    fieldLabel: "性质",
                    xtype: "textfield",
                    name: "Property",
                    maxLength: 50
                }, {
                    fieldLabel: "规模",
                    xtype: "numberfield",
                    name: "Scope",
                    maxLength: 50
                }, {
                    fieldLabel: "主页",
                    xtype: "textfield",
                    name: "HomePage",
                    maxLength: 50
                }, {
                    fieldLabel: "上级单位",
                    xtype: "textfield",
                    name: "HigherUnit",
                    maxLength: 50,
                    readOnly: true
                }, {
                    fieldLabel: "所属集团",
                    xtype: "textfield",
                    name: "UnderGroup",
                    maxLength: 50
                }, {
                    fieldLabel: "办公所在地",
                    xtype: "textfield",
                    name: "WorkPlace",
                    maxLength: 50
                },
                me.userComboBox,
                 {
                     xtype: "hiddenfield",
                     name: "UserName",
                     id: me.txtUserID
                 }, {
                     fieldLabel: "备注",
                     xtype: "textareafield",
                     name: "Remark",
                     maxLength: 200,
                     rows: 3,
                     cols: 50
                 }]
        }];
    }

})